<template>
  <div>
      <h1>学生登录页面</h1>
      <p>请输入账号：<input type="text" v-model="user"></p>
      <p>请输入密码：<input type="text" v-model="pwd"></p>
      <p><button @click="dl">登录</button></p>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            user:'',
            pwd:'',
        }
    },
    // 点击事件
    methods:{
        dl(){
            axios({
            url:'http://127.0.0.1:8000/zhu/zi2/',
            method:'post',
            data:{"user":this.user,"pwd":this.pwd}
            }).then(res=>{
            console.log(res.data)
            // 跳转
            this.$router.push("/clashow/")
            // 状态保持      挂
            sessionStorage.setItem("id",res.data.id)
            sessionStorage.setItem("user",res.data.user)
            })
        }
    }
}
</script>

<style>

</style>